package cn.com.consts;

/**
 * 模板常量
 *
 * @author LiuGuodong
 * @date 2024/04/02
 */
public interface TemplateConst {
    //表名
    String INSERT = "INSERT";

    String ACTION = "ACTION";

    String MODULE_ACTION = "MODULE_ACTION";


    //插入内容模板
    String INSERT_TEMPLATE = "('%s', '%s', '%s', null, null, '%s', null, 'admin', '2024-02-21 14:37:07'," +
            "'admin', '2024-01-15 14:37:07', 1)";

    String ACTION_TEMPLATE = "('%s', '%s',  '%s', null, '%s', null, null, '', 0, 'admin', '2024-02-21 15:25:11', 'admin'," +
            "'2024-02-21 15:25:11', 1)";


    String MODULE_ACTION_TEMPLATE = "('%s', '%s', 'admin', '2024-02-23 09:23:08', 'admin', '2024-02-23 09:23:08', 1)";


    //insert开头
    String STRING_START = "INSERT INTO res_policy_auth_action (auth_key, auth_type, name, name_en, group_id, group_name, description,\n" +
            "                                               created_by, created_dt, updated_by, updated_dt, version)\n" +
            "VALUES ";
    String ACTION_START = "INSERT INTO sys_auth_action (auth_key, auth_type, name, name_en, parent_auth_key, service_code, description,\n" +
            "                             description_en, `sensitive`, created_by, created_dt, updated_by, updated_dt,\n" +
            "                             version)\n" +
            "VALUES ";
    String MODULE_ACTION_START = "INSERT INTO sys_module_action_rela (module_auth_key, action_auth_key, created_by, created_dt, updated_by,\n" +
            "                                               updated_dt, version)\n" +
            "VALUES ";

    String RESOURCE_ENCODING = "WAF";
    String MENU_ENCODING = "DG02";


    String RES_AUTHORITY = "\n" +
            "# 初始化系统权限\n" +
            "delete\n" +
            "from sys_auth_action\n" +
            "where auth_key in ('res:WAF:*', 'res:WAF:env', 'res:WAF');\n" +
            "\n" +
            "INSERT INTO sys_auth_action (auth_key, auth_type, name, name_en, parent_auth_key, service_code, description,\n" +
            "                             description_en, `sensitive`, created_by, created_dt, updated_by, updated_dt,\n" +
            "                             version)\n" +
            "VALUES ('res:WAF', 'group', 'WAF', 'a', 'res', 'resource', '', 'a', null, null, null, null, null, null),\n" +
            "       ('res:WAF:*', 'atom', '所有系统权限', null, 'res:WAF', 'resource', null, '', 0, 'admin',\n" +
            "        '2024-02-21 15:25:11',\n" +
            "        'admin',\n" +
            "        '2024-02-21 15:25:11', 1),\n" +
            "       ('res:WAF:env', 'atom', '云资源列表详情查询', null, 'res:WAF', 'resource', null, '', 0, 'admin',\n" +
            "        '2024-02-21 15:25:11', 'admin',\n" +
            "        '2024-02-21 15:25:11', 1);\n" +
            "\n" +
            "# 权限关联接口\n" +
            "delete\n" +
            "from sys_action_url_rela\n" +
            "where interface_url_id in (1382621190865646, 1382621190865587)\n" +
            "  and action_auth_key in ('res:WAF:*', 'res:WAF:env');\n" +
            "\n" +
            "\n" +
            "INSERT INTO sys_action_url_rela (interface_url_id, action_auth_key, created_by, created_dt, updated_by,\n" +
            "                                 updated_dt, version)\n" +
            "VALUES (1382621190865646, 'res:WAF:*', 'admin', '2024-01-15 17:30:09', 'admin', '2024-01-15 17:30:09', null),\n" +
            "       (1382621190865587, 'res:WAF:*', 'admin', '2024-01-15 17:30:09', 'admin', '2024-01-15 17:30:09', null),\n" +
            "       (1382621190865646, 'res:WAF:env', 'admin', '2024-01-15 17:30:51', 'admin', '2024-01-15 17:30:51', null);\n" +
            "\n" +
            "\n" +
            "# 菜单关联权限\n" +
            "delete\n" +
            "from sys_module_action_rela\n" +
            "where module_auth_key = 'DG02'\n" +
            "  and action_auth_key in ('res:WAF:*', 'res:WAF:env');\n" +
            "\n" +
            "INSERT INTO sys_module_action_rela (module_auth_key, action_auth_key, created_by, created_dt, updated_by,\n" +
            "                                    updated_dt, version)\n" +
            "VALUES ('DG02', 'res:WAF:*', 'admin', '2024-02-23 09:23:08', 'admin', '2024-02-23 09:23:08', 1),\n" +
            "       ('DG02', 'res:WAF:env', 'admin', '2024-02-23 09:23:08', 'admin', '2024-02-23 09:23:08', 1);\n" +
            "\n" +
            "# 用户组权限关系表\n" +
            "delete\n" +
            "from sys_group_module_rela\n" +
            "where parent_module = 'DG02'\n" +
            "  and auth_key in ('res:WAF:*', 'res:WAF:env')\n" +
            "  and group_sid = 1;\n" +
            "\n" +
            "INSERT INTO sys_group_module_rela (group_sid, auth_key, rela_type, parent_module, critical, created_by,\n" +
            "                                   created_dt, updated_by, updated_dt, version, auth_type)\n" +
            "VALUES (1, 'res:WAF:*', 'action', 'DG02', 0, 'zbssadmin', '2024-04-01 21:18:14', 'zbssadmin',\n" +
            "        '2024-04-01 21:18:14', 1, 'whiteenv'),\n" +
            "       (1, 'res:WAF:env', 'action', 'DG02', 0, 'zbssadmin', '2024-04-01 21:18:14', 'zbssadmin',\n" +
            "        '2024-04-01 21:18:14', 1, 'whiteenv');\n" +
            "\n" +
            "\n" +
            "# 角色权限关系表 bss\n" +
            "delete\n" +
            "from sys_role_module_rela\n" +
            "where role_id = 410\n" +
            "  and parent_module = 'DG02'\n" +
            "  and auth_key in ('res:WAF:*', 'res:WAF:env');\n" +
            "\n" +
            "INSERT INTO sys_role_module_rela (role_id, auth_key, rela_type, parent_module, critical, created_by,\n" +
            "                                  created_dt, updated_by, updated_dt, version, auth_type)\n" +
            "VALUES (410, 'res:WAF:*', 'action', 'DG02', 0, 'zbssadmin', '2024-04-01 21:18:14', 'zbssadmin',\n" +
            "        '2024-04-01 21:18:14', 1, 'atom'),\n" +
            "       (410, 'res:WAF:env', 'action', 'DG02', 0, 'zbssadmin', '2024-04-01 21:18:14', 'zbssadmin',\n" +
            "        '2024-04-01 21:18:14', 1, 'atom');";
}
